import React from "react";
import {useRoutes, Outlet, Navigate} from "react-router-dom";
import {lazyLoading} from "@/utils";
import AuthComponent from "@/components/AuthComponent";

export default function () {
    // /cmn/dict
    return useRoutes([
        {
            path: "/",
            element:(
                <AuthComponent>
                    {
                        lazyLoading("Index")
                    }
                </AuthComponent>
            ),children:[
                {
                    // 主页
                    path:"/",
                    element:lazyLoading("Home")
                },{
                    path:"/cmn",
                    element:<Outlet/>,
                    children:[
                        {
                            index:true,
                            element:<Navigate to={"/cmn/dict"}/>
                        },
                        {
                            path:"/cmn/dict",
                            element:lazyLoading("cmn/dict")
                        }
                    ]
                }
            ]
        }, {
            path: "/login",
            element: lazyLoading("Login")
        }, {
            path: "*",
            element: lazyLoading("NotFound")
        }
    ])
}
